/**
 * Copyright (C) 2013-2014 the original author or authors.
 */
package com.foreveross.bsl.mam.app.application;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.foreveross.bsl.mam.app.application.vo.AppMainVo;

/**
 * 
 * @author tanzhixiong
 * @2013-6-21 @上午11:26:02
 */
@Path(value = "/appMains")
public interface AppMainApplication {
	
	/**
	 *  获取关联的appMain by heyaowen
	 * @param appId
	 * @return
	 */
	@GET
	@Path("/contactApps")
	@Produces({MediaType.APPLICATION_JSON })
	public List<AppMainVo> findContactAppMains(@QueryParam("identifier") String identifier, 
			@QueryParam("platform") String platform);
	
	/**
	 *  获取appMain包含关联应用 by heyaowen
	 * @param appId
	 * @return
	 */
	@GET
	@Path("/{appId}")
	@Produces({MediaType.APPLICATION_JSON })
	public AppMainVo findApp(@PathParam("appId") String appId);
	
	/**
	 *  添加appMain包含关联应用 by heyaowen
	 * @param appId
	 * @return
	 */
	@PUT
	@Path("/{appId}")
	@Produces({MediaType.APPLICATION_JSON })
	@Consumes({MediaType.APPLICATION_JSON })
	public void addApps(@PathParam("appId") String appId, List<String> ids);
	
	/**
	 *  删除appMain包含关联应用 by heyaowen
	 * @param appId
	 * @return
	 */
	@POST
	@Path("/{appId}")
	@Produces({MediaType.APPLICATION_JSON })
	@Consumes({MediaType.APPLICATION_JSON })
	public void delApps(@PathParam("appId") String appId, List<String> ids);
	
	@POST
	@Path("/add")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public AppMainVo saveEntity(AppMainVo entity);

	@PUT
	@Path("/update/{id}")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public AppMainVo updateEntity(@PathParam("id") String id, AppMainVo entity);

	@DELETE
	@Path("/delete/{id}")
	public void deleteEntity(@PathParam("id") String id);

	@GET
	@Path("/get/{id}")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public AppMainVo getEntity(@PathParam("id") String id);

	@GET
	@Path("/all")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<AppMainVo> findAll();

	@POST
	@Path("/pages")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public Page<AppMainVo> findByPageable(Pageable pageable);

	@GET
	@Path("/findCategoryId/")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<AppMainVo> getEntitybyCategoryId(@QueryParam("categoryId") String categoryId);
	
	@GET
	@Path("/findIdentify")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public AppMainVo getEntitybyIdentify(
			@QueryParam("identifyer") String identifyer);
	
	@GET
	@Path("/name")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public AppMainVo checkName(@QueryParam("name") String name);

}
